<?php

declare(strict_types=1);

namespace App\Task;



use Hyperf\Utils\ApplicationContext;
use Psr\Container\ContainerInterface;
use Psr\SimpleCache\CacheInterface;

class FooTask
{
    public function __construct()
    {
        $this->container = ApplicationContext::getContainer();
    }

    /**
     * @var ContainerInterface
     */
    protected $container;


    public function test(){
        try{
            $res = $this->container->get(CacheInterface::class)->set('name'.time(),['1234']);
        }catch (\Exception $e){
            echo $e->getMessage();
        }
    }

}
